﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>登录 - 评教系统</title>
    <link rel="stylesheet" href="~/css/header.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/footer.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/common.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/login.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/base.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/css/login.css" asp-append-version="true" />
    <style>
        .content {
            background: url("../images/1 (1).jpg") no-repeat center /cover;
        }

    </style>
    <script src="~/lib/jquery2.1.4/dist/jquery.min.js" asp-append-version="true"></script>
</head>
<body>
    <header class="header">
        <img src="~/images/logo2.png" alt="logo" class="logo">
    </header>
    <div ng-app="myApp">
        <div class="content">
            <div class="login">
                <form asp-action="Login" method="post" id="form">
                    <div class="title">网上评教系统</div>
                    <div class="identity">
                        <span>身  份</span>
                        <input type="radio" name="identity" value="student" id="student" checked><label for="student">学生</label>
                        <input type="radio" name="identity" value="teacher" id="teacher"><label for="teacher">教师</label>
                        <input type="radio" name="identity" value="leader" id="leader"><label for="leader">管理员</label>
                    </div>
                    <div class="account">
                        <span>账  号</span>
                        <input type="text" name="userid" id="userid" placeholder="请输入你的工号/学号">
                    </div>
                    <div class="password">
                        <span>密  码</span>
                        <input type="password" name="password" id="pwd" placeholder="请输入你的密码">
                    </div>
                    <div class="login_btn">
                        <input id="login" type="submit" class="btn" value="登录" />
                    </div>
                </form>
            </div>
        </div>
    </div>
    @await Html.PartialAsync("Footer")

    <script>
        $(function(){
            $("#form").submit(function(event){
                if(!login())
                    event.preventDefault();
            });


            function login(){
                var type = $("[name='identity']:checked").val();
                var id = $("#userid").val();
                var pwd = $("#pwd").val();
                var verify = true;

                if(id === '' || pwd === ''){
                    alert("用户名或密码不能为空！")
                    verify = false;
                }else if(type === "student"){
                    var reg1 = /^student+\d+$/;
                    if(!reg1.test(id)){
                        alert("用户名输入有误！")
                        verify = false;
                    }
                }else if(type == "teacher"){
                    var reg = /^teacher+\d+$/;
                    if(!reg.test(id)){
                        alert("用户名输入有误！")
                        verify = false;
                    }
                }else if(type == "leader"){
                    if(id!="leader"){
                        alert("用户名输入有误！")
                        verify = false;
                    }
                }
                return verify;
            }
        })
    </script>
</body>
</html>
